/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package guestbook.persistencia;

import com.google.appengine.api.datastore.Key;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author jperez
 */



@Entity
public class Usuario implements Serializable {
    
    
    @Id
    private String username;

    @Column(nullable = false)
    private String password;

    @Basic
    List<Key> roles = new ArrayList<Key>();

    @Basic
    List<Key> votos = new ArrayList<Key>();
    
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public List<Key> getRoles() {
        return roles;
    }

    public void setRoles(List<Key> roles) {
        this.roles = roles;
    }

    public List<Key> getVotos() {
        return votos;
    }

    public void seVotos(List<Key> votos) {
        this.votos = votos;
    }

    

    @Override
    public boolean equals(Object o) {
        Usuario usuario = (Usuario)o;
        return super.equals(username.equals(usuario.getUsername()));
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 23 * hash + (this.username != null ? this.username.hashCode() : 0);
        return hash;
    }

    

    @Override
    public String toString() {
        return "Usuario{" + "username=" + username + '}';
    }

}
